from core import *


class Action(Object):
    needs_position =_ (False)


class AreaAction(Object):
    needs_position =_ (True)
    
    position = Attribute(writable = True)
    area     = Attribute(writable = True)
    
    @property
    def has_position(self):
        return self.position is not None
    
    @property
    def has_area(self):
        return self.area is not None

    def extend_to(self, position):
        if self.position:
            self.area = self.position.extend_to(position)
        else:
            self.area = None
